Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix on typed select #4529

Merged
merged 6 commits into from
Mar 4, 2025
Merged

Conversation

lelemm
Copy link
Contributor

@lelemm lelemm commented Mar 4, 2025

After pluggy was merged, typecheck, tests and api workflows are complaning about a unknown type.
This fixes it

@actual-github-bot actual-github-bot bot changed the title 🐛 Fix on typed select [WIP] 🐛 Fix on typed select Mar 4, 2025
Copy link

netlify bot commented Mar 4, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 83d6d66
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/67c6e91385e6980008734201
😎 Deploy Preview https://deploy-preview-4529.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Mar 4, 2025

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
18 8.06 MB → 8.07 MB (+14.8 kB) +0.18%
Changeset
File Δ Size
src/components/modals/PluggyAiInitialiseModal.tsx 🆕 +5.8 kB 0 B → 5.8 kB
src/hooks/usePluggyAiStatus.ts 🆕 +583 B 0 B → 583 B
src/components/modals/CreateAccountModal.tsx 📈 +6.36 kB (+40.82%) 15.59 kB → 21.95 kB
src/components/banksync/EditSyncAccount.tsx 📈 +674 B (+11.25%) 5.85 kB → 6.51 kB
src/hooks/useFeatureFlag.ts 📈 +27 B (+7.61%) 355 B → 382 B
src/components/settings/Experimental.tsx 📈 +334 B (+7.23%) 4.51 kB → 4.83 kB
home/runner/work/actual/actual/packages/loot-core/src/client/accounts/accountsSlice.ts 📈 +333 B (+6.29%) 5.17 kB → 5.49 kB
src/components/reports/spreadsheets/summary-spreadsheet.ts 📈 +250 B (+4.30%) 5.68 kB → 5.92 kB
src/components/modals/SelectLinkedAccountsModal.jsx 📈 +311 B (+3.79%) 8.02 kB → 8.32 kB
src/components/Modals.tsx 📈 +165 B (+0.94%) 17.2 kB → 17.36 kB
src/components/banksync/index.tsx 📈 +27 B (+0.82%) 3.23 kB → 3.25 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 5.33 MB → 5.34 MB (+14.56 kB) +0.27%
static/js/ReportRouter.js 1.59 MB → 1.59 MB (+250 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/en-GB.js 96.66 kB 0%
static/js/de.js 115.52 kB 0%
static/js/en.js 103.78 kB 0%
static/js/es.js 58.26 kB 0%
static/js/nl.js 95.51 kB 0%
static/js/fr.js 116.48 kB 0%
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/pt-BR.js 110.52 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 86.26 kB 0%
static/js/uk.js 111.06 kB 0%
static/js/useAccountPreviewTransactions.js 1.69 kB 0%
static/js/AppliedFilters.js 10.8 kB 0%
static/js/wide.js 103.68 kB 0%

Copy link
Contributor

github-actions bot commented Mar 4, 2025

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.34 MB → 1.34 MB (+1.9 kB) +0.14%
Changeset
File Δ Size
packages/loot-core/src/server/accounts/app.ts 📈 +2.58 kB (+10.54%) 24.49 kB → 27.07 kB
packages/loot-core/src/server/server-config.ts 📈 +60 B (+5.27%) 1.11 kB → 1.17 kB
packages/loot-core/src/server/accounts/sync.ts 📈 +1.28 kB (+4.55%) 28.12 kB → 29.4 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.34 MB → 1.34 MB (+1.9 kB) +0.14%

Smaller

No assets were smaller

Unchanged

No assets were unchanged

@lelemm lelemm changed the title [WIP] 🐛 Fix on typed select 🐛 Fix on typed select Mar 4, 2025
Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

Walkthrough

The diff updates the type annotation for the variable accRow in the linkPluggyAiAccount function found in packages/loot-core/src/server/accounts/app.ts. The variable is now explicitly typed as db.DbAccount, ensuring it matches the expected structure defined by this type. A new error handling condition has been added, which throws an error if accRow is not found (i.e., it is null or undefined), indicating that the account with the specified upgradingId was not found. The SQL query used to obtain the account row remains unchanged, as does the subsequent logic that assigns the id and updates the account in the database. The control flow and error handling in the function continue to operate as before, and there are no modifications to any exported or public declarations.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 838feef and 83d6d66.

📒 Files selected for processing (1)
  • packages/loot-core/src/server/accounts/app.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/loot-core/src/server/accounts/app.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Wait for Netlify build to finish
  • GitHub Check: test
  • GitHub Check: Analyze

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8d14ca and deaa084.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/4529.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • packages/loot-core/src/server/accounts/app.ts (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Test
packages/loot-core/src/server/accounts/app.ts

[error] 275-275: 'accRow' is possibly 'null'.

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Wait for Netlify build to finish
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (1)
packages/loot-core/src/server/accounts/app.ts (1)

270-274:

❓ Verification inconclusive

Verify consistency with similar functions in the codebase

The type annotation for db.first<db.DbAccount> is correct, but it's important to ensure consistent error handling across similar functions.


🏁 Script executed:

#!/bin/bash
# Description: Check how other similar functions handle potential null results from db.first

echo "Checking account retrieval patterns in the codebase:"
rg "const accRow = await db.first.*WHERE id = \?.*\[.*\]" -A 5 --multiline

Length of output: 191


Action Required: Verify Consistency in Error Handling

The current implementation uses await db.first<db.DbAccount>(...) without an explicit check for a null result. The verification script did not return matching patterns from other parts of the codebase, so it's unclear if similar functions perform additional error handling (e.g., checking for a null return value and handling it appropriately).

  • Next Step: Manually review other functions that use db.first to confirm if they include extra error handling logic. If they do, ensure that this function follows the same pattern; otherwise, consider adding a null check or equivalent error handling to maintain consistency across similar functions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between deaa084 and 838feef.

📒 Files selected for processing (1)
  • packages/loot-core/src/server/accounts/app.ts (1 hunks)
🧰 Additional context used
🪛 ESLint
packages/loot-core/src/server/accounts/app.ts

[error] 279-279: Delete ········

(prettier/prettier)

🪛 GitHub Check: lint
packages/loot-core/src/server/accounts/app.ts

[failure] 279-279:
Delete ········

🪛 GitHub Actions: Test
packages/loot-core/src/server/accounts/app.ts

[error] 279-279: Prettier formatting check failed. Delete ········.

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Functional
  • GitHub Check: Visual regression
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Analyze
🔇 Additional comments (1)
packages/loot-core/src/server/accounts/app.ts (1)

271-278: Good addition of null check and proper type annotation ✅

The changes correctly add a proper type annotation for the accRow variable and introduce a null check before using accRow.id, which prevents potential TypeScript errors. This addresses the "unknown type error" mentioned in the PR objectives.

@lelemm lelemm merged commit abb6e86 into actualbudget:master Mar 4, 2025
21 checks passed
@lelemm lelemm deleted the bugfix/typecheck_pluggy branch March 4, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants